#ifndef COMMAND_H
#define COMMAND_H
#include<QUndoCommand>
#include<QVector>
#include<QString>
#include"Message.h"
#include"MessageTypes.h"
//#include "centralController.h"
#include "..\DataManipulator\datamanipulator.h"
class MacroCommand:public QUndoCommand
{
public:
	QVector<QUndoCommand*>commands;
	MacroCommand();
	~MacroCommand();
	void redo();
	void undo();
};
class addNewNodeCommand:public QUndoCommand
{
private:
    nodePath containerNodePath;
    int index;
    NewNodeArgs args;
    DataManipulator* datamanipulator;
public:
	addNewNodeCommand();
    addNewNodeCommand(nodePath cn,NewNodeArgs ar,DataManipulator* da);
    ~addNewNodeCommand();
    void redo();
    void undo();
};


class setPropertyCommand:public QUndoCommand
{
private:
    nodePath currentNodePath;
    //Index editIndex;
    SetArgs oldargs;
    DataManipulator* dataManipulator;
    SetArgs args;

public:
	setPropertyCommand();
    setPropertyCommand(nodePath p,SetArgs a,DataManipulator* da);
    ~setPropertyCommand();
    void redo();
    void undo(); 
};

class deleteNodeCommand:public QUndoCommand
{
private:
    nodePath containerPath;
    int deleteIndex;
    NodeType deleteNodeType;
	DisplayNode* old;
    DataManipulator* datamanipulator;
public:
	deleteNodeCommand();
    deleteNodeCommand(nodePath np,DataManipulator* da);
    ~deleteNodeCommand();
    void redo();
    void undo();
};
class setStaticPropertyCommand:public QUndoCommand
{
	 nodePath currentNodePath;
	 SetStaticProperArgs oldArgs;
	 SetStaticProperArgs newArgs;
	 DataManipulator* datamanipulator;
public:
	setStaticPropertyCommand();
	~setStaticPropertyCommand();
	setStaticPropertyCommand(nodePath np,SetStaticProperArgs a,DataManipulator* da);
	void undo();
	void redo();

};
class nodeConvertCommand:public QUndoCommand

{
	 nodePath currentNodePath;
	 DisplayNode* oldNode;
	 NodeType oldType;
	 NodeType newType;
	 DataManipulator* datamanipulator;
public:
	nodeConvertCommand();
	nodeConvertCommand(nodePath cn,NodeType tp,DataManipulator* da);
	~nodeConvertCommand();
	void redo();
	void undo();
};
class swapLayerCommand:public QUndoCommand
{
	 nodePath containerNodePath;
	int originalIndex;
	int destIndex;
    DataManipulator* datamanipulator;
public:
	swapLayerCommand();
	swapLayerCommand(nodePath cp,int ori,int aimindex,DataManipulator* da);
	~swapLayerCommand();
	void redo();
	void undo();
};
class addCurvePointCommand:public QUndoCommand
{
	nodePath path;
	AddPointArgs args;
	int addIndex;
	DataManipulator* datamanipulator;
public:
	addCurvePointCommand();
	~addCurvePointCommand();
	addCurvePointCommand(nodePath np,AddPointArgs a,DataManipulator* da);
	void redo();
	void undo();
};
class moveCurvePointCommand:public QUndoCommand
{
	MovePointArgs args;
	nodePath path;
	DataManipulator* datamanipulator;
public:
	moveCurvePointCommand();
	~moveCurvePointCommand();
	moveCurvePointCommand(nodePath np,MovePointArgs a,DataManipulator* da);
	void redo();
	void undo();

};
class deletePointCommand:public QUndoCommand
{
	nodePath path;
	int deleteIndex;
	ePtType deleteType;
	QPointF deletePoint;
	DataManipulator* datamanipulator;
	QPointF LCpoint;
public:
	deletePointCommand();
	~deletePointCommand();
	deletePointCommand(nodePath np,int dindex,DataManipulator* da);
	void redo();
	void undo();

};
class changePointTypeCommand:public QUndoCommand
{ 
	nodePath path;
	ChangePointTypeArgs args;
	ePtType oldType;
	DataManipulator* datamanipulator;
public:
	changePointTypeCommand();
	~changePointTypeCommand();
	changePointTypeCommand(nodePath np,ChangePointTypeArgs a,DataManipulator* da);
	void redo();
	void undo();
};
class setGradientCommand:public QUndoCommand
{
	nodePath path;
	SetGradientArgs args;
    QGradient* oldGradient;
	DataManipulator* datamanipulator;
public:
	setGradientCommand();
	~setGradientCommand();
	setGradientCommand(nodePath np,SetGradientArgs a,DataManipulator* da);
	void redo();
	void undo();
};
#endif // COMMAND_H
